package net.cc.service;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.junit.Test;

import net.cc.service.HelloWorld;

/**
 * @author 本地测试
 * @create 2014-3-11上午11:26:13
 * @version 1.0
 */
public class HelloClient {

    public static void main(String[] args) {

        // 创建代理工厂
        JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
        
        // 设置代理工厂属性(服务类以及地址)
        factoryBean.setServiceClass(HelloWorld.class);
        factoryBean.setAddress("http://101.201.151.109:7890/HelloWorld");
        
        // 调用
        HelloWorld helloWorld = (HelloWorld) factoryBean.create();
        System.out.println(helloWorld.sayHello("振华"));

    }
    @Test
    public void test(){
        // 创建代理工厂
        JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
        
        // 设置代理工厂属性(服务类以及地址)
        factoryBean.setServiceClass(HelloWorld.class);
        factoryBean.setAddress("http://101.201.151.109:7890/HelloWorld");
        
        // 调用
        HelloWorld helloWorld = (HelloWorld) factoryBean.create();
        System.out.println(helloWorld.sayHello("振华")); 
    }
}